<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="using:GoG.Board">

    <Style TargetType="local:GameBoard">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:GameBoard">
                    <Grid x:Name="TopGrid">
                        <!--<VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="BoardStates">
                                <VisualState x:Name="Default" />
                                <VisualState x:Name="GameOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="GameOverDisplay" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <PopInThemeAnimation FromHorizontalOffset="-50"
                                                 SpeedRatio=".4"
                                                 Storyboard.TargetName="GameOverDisplay" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>-->

                        <Grid.Resources>
                            <Storyboard x:Name="DisplayMessageStoryboard">
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MessageDisplay" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimation BeginTime="0:0:0"
                                                 Duration="0:0:0.5"
                                                 Storyboard.TargetName="MessageDisplay"
                                                 Storyboard.TargetProperty="Opacity"
                                                 To="1" />
                                <PopInThemeAnimation FromHorizontalOffset="-100"
                                                     SpeedRatio=".4"
                                                     Storyboard.TargetName="SlidingContent" />
                            </Storyboard>
                            <Storyboard x:Name="HideMessageStoryboard">
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MessageDisplay" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0.3" Value="Collapsed" />
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimation BeginTime="0:0:0"
                                                 Duration="0:0:0.3"
                                                 Storyboard.TargetName="MessageDisplay"
                                                 Storyboard.TargetProperty="Opacity"
                                                 To="0" />
                                <PopOutThemeAnimation SpeedRatio=".4"
                                                      Storyboard.TargetName="SlidingContent" />
                            </Storyboard>
                        </Grid.Resources>

                        <Grid x:Name="PART_GridContainer">
                            <Border x:Name="PART_GameBorder"
                                    Background="#8BD0C777"
                                    CornerRadius="3"
                                    Grid.Column="1"
                                    Grid.Row="1">
                            </Border>
                        </Grid>

                        <Grid x:Name="MessageDisplay" 
                              VerticalAlignment="Center"
                              HorizontalAlignment="Stretch"
                              Visibility="Collapsed"
                              Opacity="0">
                            <Border>
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0,1" EndPoint="1,1" >
                                        <GradientStop Color="#00000000" Offset="0"/>
                                        <GradientStop Color="#50000000" Offset="0.2"/>
                                        <!--<GradientStop Color="#70000000" Offset="0.5"/>-->
                                        <GradientStop Color="#50000000" Offset="0.8"/>
                                        <GradientStop Color="#00000000" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                                <StackPanel Orientation="Horizontal"
                                            HorizontalAlignment="Center"
                                            x:Name="SlidingContent" >
                                    <ProgressRing x:Name="BusyRing"
                                                  Width="40"
                                                  Height="40"
                                                  Margin="0,5,10,5"
                                                  VerticalAlignment="Center"
                                                  Foreground="White"
                                                  IsActive="{TemplateBinding IsBusy}"/>
                                    <TextBlock Text="{TemplateBinding MessageText}" 
                                               Foreground="White"
                                               FontSize="30"
                                               FontWeight="Normal"
                                               Margin="0,10"
                                               VerticalAlignment="Center"/>
                                </StackPanel>
                            </Border>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:GamePiece">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:GamePiece">
                    <Grid Background="#01000000">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="States">
                                <VisualState x:Name="HintNewCapture">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="CapturedIndicator"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1"
                                                         Duration="0:0:1"/>
                                        <DoubleAnimation Storyboard.TargetName="PART_Ellipse"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         Duration="0:0:1"
                                                         To="0"/>
                                        <DoubleAnimation Duration="0:0:0"
                                                         Storyboard.TargetName="PART_HintEllipse"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1" />
                                        <!--<DoubleAnimation Duration="0:0:1"
                                                         Storyboard.TargetName="PART_HintEllipse"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)"
                                                         To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation Duration="0:0:1"
                                                         Storyboard.TargetName="PART_HintEllipse"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)"
                                                         To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>-->

                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="Hint">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0"
                                                         Storyboard.TargetName="PART_HintEllipse"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0:0:1"
                                                         Storyboard.TargetName="PART_HintEllipse"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)"
                                                         To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation Duration="0:0:1"
                                                         Storyboard.TargetName="PART_HintEllipse"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)"
                                                         To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>

                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="NewCapture">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="CapturedIndicator"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1"
                                                         Duration="0:0:1"/>
                                        <DoubleAnimation Storyboard.TargetName="PART_Ellipse"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         Duration="0:0:1"
                                                         To="0.1"/>
                                        <!--<DoubleAnimation Duration="0:0:0.5"
                                                         Storyboard.TargetName="PART_Ellipse"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)"
                                                         To="0.6">
                                            <DoubleAnimation.EasingFunction>
                                                <QuadraticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation Duration="0:0:0.5"
                                                         Storyboard.TargetName="PART_Ellipse"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)"
                                                         To="0.6">
                                            <DoubleAnimation.EasingFunction>
                                                <QuadraticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>-->

                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="Blank">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Ellipse"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <DiscreteDoubleKeyFrame KeyTime="0"
                                                                    Value="1" />
                                            <DiscreteDoubleKeyFrame KeyTime="0:0:1"
                                                                    Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0:0:1"
                                                         Storyboard.TargetName="PART_Ellipse"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)"
                                                         To="0.7">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation Duration="0:0:1"
                                                         Storyboard.TargetName="PART_Ellipse"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)"
                                                         To="0.7">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>

                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="White">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Ellipse"
                                    			Storyboard.TargetProperty="(Shape.Fill)">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                        <GradientStop Offset="0.25" Color="White" />
                                                        <GradientStop Offset="0.993" Color="#FFCBCBCB" />
                                                    </LinearGradientBrush>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0:0:0"
                                    			         Storyboard.TargetName="PART_Ellipse"
                                    			         Storyboard.TargetProperty="(UIElement.Opacity)"
                                    			         To="1" />
                                        <DoubleAnimation Duration="0:0:1"
                                    			         Storyboard.TargetName="PART_Ellipse"
                                    			         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)"
                                    			         To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation Duration="0:0:1"
                                    			         Storyboard.TargetName="PART_Ellipse"
                                    			         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)"
                                    			         To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name="WhiteLastMove">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Ellipse"
                                    			                       Storyboard.TargetProperty="(Shape.Fill)">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                        <GradientStop Offset="0.25" Color="White" />
                                                        <GradientStop Offset="0.993" Color="#FFCBCBCB" />
                                                    </LinearGradientBrush>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0:0:0"
                                    			         Storyboard.TargetName="PART_Ellipse"
                                    			         Storyboard.TargetProperty="(UIElement.Opacity)"
                                    			         To="1" />
                                        <DoubleAnimation Duration="0:0:1"
                                    			         Storyboard.TargetName="PART_Ellipse"
                                    			         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)"
                                    			         To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation Duration="0:0:1"
                                    			         Storyboard.TargetName="PART_Ellipse"
                                    			         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)"
                                    			         To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>

                                        <ColorAnimation Duration="0:0:1" To="Black" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="LastMoveIndicator" />
                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name="Black">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Ellipse"
                                                                        Storyboard.TargetProperty="(Shape.Fill)">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                        <GradientStop Offset="0.25" Color="#FF4D4D4D" />
                                                        <GradientStop Offset="0.993" Color="Black" />
                                                    </LinearGradientBrush>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0:0:0"
                                                         Storyboard.TargetName="PART_Ellipse"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1" />

                                        <DoubleAnimation Duration="0:0:1"
                                                         Storyboard.TargetName="PART_Ellipse"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)"
                                                         To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation Duration="0:0:1"
                                                         Storyboard.TargetName="PART_Ellipse"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)"
                                                         To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="BlackLastMove">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Ellipse"
                                                                       Storyboard.TargetProperty="(Shape.Fill)">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                        <GradientStop Offset="0.25" Color="#FF4D4D4D" />
                                                        <GradientStop Offset="0.993" Color="Black" />
                                                    </LinearGradientBrush>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0:0:0"
                                                         Storyboard.TargetName="PART_Ellipse"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1" />

                                        <DoubleAnimation Duration="0:0:1"
                                                         Storyboard.TargetName="PART_Ellipse"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)"
                                                         To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation Duration="0:0:1"
                                                         Storyboard.TargetName="PART_Ellipse"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)"
                                                         To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <ElasticEase />
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>

                                        <ColorAnimation Duration="0:0:1" To="White" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="LastMoveIndicator" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Ellipse x:Name="PART_Ellipse"
                                 Margin="{TemplateBinding CircleMargin}"
                                 Opacity="0"
                                 RenderTransformOrigin="0.5,0.5">
                            <Ellipse.RenderTransform>
                                <CompositeTransform ScaleX="0.6"
                                                    ScaleY="0.6" />
                            </Ellipse.RenderTransform>
                        </Ellipse>

                        <Ellipse x:Name="PART_HintEllipse"
                                 Margin="{TemplateBinding CircleMargin}"
                                 Opacity="0"
                                 Stroke="Yellow"
                                 StrokeThickness="5"
                                 RenderTransformOrigin="0.5,0.5">
                            <Ellipse.RenderTransform>
                                <CompositeTransform ScaleX="0.6"
                                                    ScaleY="0.6" />
                            </Ellipse.RenderTransform>
                        </Ellipse>

                        <Viewbox>
                            <Border x:Name="LastMoveIndicator" 
                                    Width="10" Height="10"
                                    Margin="12"
                                    BorderBrush="Transparent"
                                    BorderThickness="2"
                                    CornerRadius="2"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center">
                            </Border>
                        </Viewbox>

                        <Grid x:Name="CapturedIndicator"
                              Margin="14,14,15,15" 
                              Opacity="0"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Center">
                            <Line X1="0" Y1="10" X2="10" Y2="0" Stroke="Red" StrokeThickness="1"/>
                            <Line X1="0" Y1="0" X2="10" Y2="10" Stroke="Red" StrokeThickness="1"/>
                        </Grid>

                        <!--<Viewbox>
                            <TextBlock Margin="16"
                                        FontSize="50"
                                        FontWeight="Bold"
                                        Text="{TemplateBinding Sequence}" />
                        </Viewbox>-->
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        <Ellipse.Fill>
        <RadialGradientBrush>
        <GradientStop Offset="0"
        Color="Lime" />
        <GradientStop Offset="1"
        Color="Lime" />
        <GradientStop Offset="1"
        Color="Gold" />
        <RadialGradientBrush.Transform>
        <TransformGroup>
        <ScaleTransform ScaleY="0.65" />
        </TransformGroup>
        </RadialGradientBrush.Transform>
        </RadialGradientBrush>
        </Ellipse.Fill>
    -->
</ResourceDictionary>